import React, { useEffect, useState } from 'react'

export default function App() {
  let [opacity,setOpacity]=useState(1)

  useEffect(()=>{
    const addTime=setInterval(()=>{
      opacity-=0.1
      if(opacity<=0){
        opacity=1
      }
      setOpacity(opacity)
    },100)

    return ()=>{
      clearInterval(addTime)
    }
  },[])
  return (
    <div>
      <h1 style={{opacity}}>今天好热啊</h1>
    </div>
  )
}
